function categoryTogglerStructure (element, container, subelement){
    catthis = this;
    var clickElement = element;
    
    $j(subelement).live('click', function(){
        catthis.subCategoryTogglerAction(this);
        return false;
    })
    $j(clickElement).click(function(){
        catthis.categoryTogglerAction(this);
        return false;
    })
    this.categoryTogglerAction = function (current){
        var currentContainer = $j('.item').has(current);
        if($j(currentContainer).is('.open')){
            catthis.hideElements();
        }else{
            catthis.hideElements();
            $j(currentContainer).find('.sub').show();
            $j(currentContainer).addClass('open'); 
        }
    };
    
    this.subCategoryTogglerAction = function (cur){
        var subCurrentContainer = $j('.sub-item').has(cur);
        if($j(subCurrentContainer).is('.open')){
           $j(subCurrentContainer).find('.sub-sub').hide();
            $j(subCurrentContainer).removeClass('open'); 
        }else{
            $j(subCurrentContainer).find('.sub-sub').show();
            $j(subCurrentContainer).addClass('open');
        }
    };
    this.hideElements = function(){
        $j(subelement).removeClass('open');
        $j(container).removeClass('open');
        $j(container).find('.sub').hide();
        $j(container).find('.sub-sub').hide();
    }
}